@extends('admin.app')

@section('content')
  <div class="panel panel-default">
    <div class="panel-heading font-bold">
      代码信息表单
    </div>
    <div class="panel-body">
      <form class="form-horizontal form-validation" action="{{ admin_action('System\CodesController@update', [$codeType, $code]) }}" method="post">
        {{ csrf_field() }}
        {{ method_field('PUT') }}
        <div class="form-group">
          <label class="col-lg-2 control-label">代码*</label>
          <div class="col-lg-10">
            <input type="text" class="form-control" name="code" value="{{ $code->code }}" placeholder="请输入代码" data-rule-required="true" data-rule-maxlength="50"> 
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <label class="col-lg-2 control-label">名称*</label>
          <div class="col-lg-10">
            <input type="text" class="form-control" name="name" value="{{ $code->name }}" placeholder="请输入名称" data-rule-required="true" data-rule-maxlength="50"> 
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <label class="col-lg-2 control-label">代码类别*</label>
          <div class="col-lg-10">
          	<p class="form-control-static">{{ $codeType->id }}</p>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <label class="col-lg-2 control-label">父代码*</label>
          <div class="col-lg-10">
          	<p class="form-control-static">{{ $code->parent_code ?? '无' }}</p>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <label class="col-lg-2 control-label">描述</label>
          <div class="col-lg-10">
            <textarea class="form-control" rows="4" name="description" placeholder="请输入描述信息" data-rule-maxlength="100">{{ $code->description }}</textarea>              
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <label class="col-lg-2 control-label">排序*</label>
          <div class="col-lg-10">
            <input type="text" class="form-control" name="sort" value="{{ $code->sort ?? 0 }}" placeholder="请输入排序" data-rule-required="true" data-rule-maxlength="50"> 
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <label class="col-lg-2 control-label">叶子节点</label>
          <div class="col-lg-10">
            <div class="radio-inline">
              <label class="i-checks">
                <input type="radio" name="tree" value="0" checked="">
                <i></i>
                否
              </label>
            </div>
            <div class="radio-inline">
              <label class="i-checks">
                <input type="radio" name="tree" value="1" {{ $code->tree ? 'checked' : '' }}>
                <i></i>
                是
              </label>
            </div>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <div class="col-lg-4 col-lg-offset-2">
            <a href="{{ admin_action('System\CodesController@index', [$codeType]) }}" class="btn btn-default">返&nbsp;回</a>
            <button type="submit" class="btn btn-primary">保&nbsp;存</button>
          </div>
        </div>
      </form>
    </div>
  </div>
@endsection